﻿<%@ Page Title="" Language="C#" MasterPageFile="~/ReconSite.Master" AutoEventWireup="true"
    CodeBehind="AuthorizeInvoice.aspx.cs" Inherits="ReconUI.AuthorizeInvoice" %>

<asp:Content ID="TitleContent" ContentPlaceHolderID="TitleHolder" runat="server">
    <title>Authorize Invoices</title>
</asp:Content>
<asp:Content ID="BodyContent" ContentPlaceHolderID="BodyHolder" runat="server">
     <div class="formDiv" id="formMatchDiv">
        <asp:Panel ID="pnlAuthList" runat="server"  class="pnlMatchList">
          <%--  <span style="azimuth: center; position: absolute; top: 200px;">--%>
                <asp:Label ID="lblAuthList" runat="server" Text="List of Selected Invoice:Statement Matches available for Authorization:" />
                <div style="height:380px; width:900px; overflow:auto;">
                <asp:GridView ID="grdAuthList" runat="server" AllowPaging="false" 
                        AutoGenerateColumns="False" Width="850"
                        HeaderStyle-BackColor="silver" HeaderStyle-ForeColor="#6f788f" 
                            HeaderStyle-Font-Bold="false"  
                        OnPageIndexChanging="grdAuthList_PageIndexChanging" 
                        onrowdatabound="grdAuthList_RowDataBound">
                    <EmptyDataTemplate>
                        <asp:Label ID="lblNoRows" runat="server" Text="There are no Invoice:Statement match selections available for Authorization." />
                    </EmptyDataTemplate>
                    <Columns>
                        <asp:TemplateField HeaderText="Select" HeaderStyle-Font-Bold = "false">
                        <HeaderTemplate>
                                    <input id ="SelectAllCheckBox" type="checkbox" name="SelectAllCheckBox" onclick="javascript:SelectAllStatement(this)">
                           </HeaderTemplate>
                            <ItemTemplate>
                                <asp:Literal ID="ltlInvoiceUniqueID" runat="server" Text='<%# Eval("invoice_unique_id") %>'
                                    Visible="false" />
                                <asp:Literal ID="ltlStatementUniqueID" runat="server" Text='<%# Eval("statement_unique_id") %>'
                                    Visible="false" />
                                <asp:CheckBox ID="chkSelect" runat="server" Checked="true" />
                            </ItemTemplate>
                        </asp:TemplateField>
                        <asp:BoundField HeaderText="Invoice No" DataField="invoice_number" HeaderStyle-Font-Bold = "false"/>
                        <asp:BoundField HeaderText="Date" DataField="date" HeaderStyle-Font-Bold = "false"/>
                        <asp:BoundField HeaderText="Remitter" DataField="remitter_id" HeaderStyle-Font-Bold = "false"/>
                        <asp:BoundField HeaderText="Amount" DataField="inv_amount" HeaderStyle-Font-Bold = "false"/>
                        <asp:BoundField HeaderText="Payment Ref No/Cheque No" DataField="ref_no_or_cheque_no" HeaderStyle-Font-Bold = "false"/>
                        <asp:BoundField HeaderText="Date" DataField="value_date" HeaderStyle-Font-Bold = "false"/>
                        <asp:BoundField HeaderText="Narration1" DataField="narration1" HeaderStyle-Font-Bold = "false"/>
                        <asp:BoundField HeaderText="Amount" DataField="stmt_amount" HeaderStyle-Font-Bold = "false"/>
                    </Columns>
                </asp:GridView>
                </div>
           <%-- </span>--%>
            <div style="azimuth: center;">
                <asp:Button ID="btnAuthorize" runat="server" Text="Authorize" OnClick="btnAuthorize_Click" />
                &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
                <asp:Button ID="btnReject" runat="server" Text="Reject" OnClick="btnReject_Click" />
            </div>
        </asp:Panel>
    </div>
    <script type="text/javascript">
        function SelectAllStatement(CheckBoxControl) {
            if (CheckBoxControl.checked == true) {
                var i;
                for (i = 0; i < document.forms[0].elements.length; i++) {
                    if ((document.forms[0].elements[i].type == 'checkbox') && (document.forms[0].elements[i].name.indexOf('grdAuthList') > -1)) {
                        document.forms[0].elements[i].checked = true;
                    }
                }
            }
            else {
                var i;
                for (i = 0; i < document.forms[0].elements.length; i++) {
                    if ((document.forms[0].elements[i].type == 'checkbox') &&
                    (document.forms[0].elements[i].name.indexOf('grdAuthList') > -1)) {
                        document.forms[0].elements[i].checked = false;
                    }
                }
            }
        }
        </script>
</asp:Content>
